package org.sky.auto.driver;


import org.openqa.selenium.WebDriver;

@Deprecated
public class DriverHandler {
	Driver driver;
	//获得Driver类的对象
	public Driver getDriver() {
		return driver;
	}
	public void setDriver(Driver driver) {
		this.driver = driver;
		
	}

	volatile static DriverHandler handler;
	public static DriverHandler getInstance(){
		if(handler==null){
			synchronized (DriverHandler.class) {
				if(handler==null){
					handler= new DriverHandler();
				}
			}
		}
		return handler;
	}
	
	
	public static DriverHandler getHandler() {
		return handler;
	}


	public static void setHandler(DriverHandler handler) {
		DriverHandler.handler = handler;
	}

	public WebDriver getBrowserDriver(Browser browser){
		if(driver==null){
			DriverHandler.getInstance().setDriver(Driver.WebDriverEngine(browser));
		}
		return (WebDriver) driver.getEngine();
	}
	
	
	
}

